<template>
  <div class="not-found-container">
    <div class="not-found-content">
      <!-- 404 图标区域 -->
      <div class="icon-section">
        <div class="error-code">404</div>
        <el-icon class="warning-icon" size="60">
          <WarningFilled />
        </el-icon>
      </div>
      
      <!-- 标题和描述 -->
      <div class="message-section">
        <h1 class="title">页面不存在</h1>
        <p class="description">
          抱歉，您访问的页面不存在或已被移动。
          <br>
          请检查URL是否正确，或返回首页继续浏览。
        </p>
      </div>
      
      <!-- 操作按钮区域 -->
      <div class="action-section">
        <el-button 
          type="primary" 
          class="idoo-details-add" 
          size="large"
          @click="goHome">
          <el-icon class="mr-2"><House /></el-icon>
          返回首页
        </el-button>
        <el-button 
          class="idoo-details-button" 
          size="large"
          @click="goBack">
          <el-icon class="mr-2"><Back /></el-icon>
          返回上页
        </el-button>
      </div>
      
      <!-- 底部链接 -->
      <div class="footer-links">
        <el-link class="link-item" @click="goHome">首页</el-link>
        <el-divider direction="vertical" />
        <el-link class="link-item" @click="contactSupport">联系支持</el-link>
        <el-divider direction="vertical" />
        <el-link class="link-item" @click="reportIssue">报告问题</el-link>
      </div>
    </div>
  </div>
</template>

<script>
import { ElMessage } from 'element-plus'
import { House, Back, WarningFilled } from '@element-plus/icons-vue'

export default {
  name: 'NotFound',
  components: {
    House,
    Back,
    WarningFilled
  },
  setup() {
    const goHome = () => {
      // 导航到首页
      window.location.href = '/'
    }
    
    const goBack = () => {
      // 返回上一页
      if (window.history.length > 1) {
        window.history.back()
      } else {
        goHome()
      }
    }
    
    const contactSupport = () => {
      ElMessage.info('正在跳转到支持页面...')
      // 这里可以添加联系支持的逻辑
    }
    
    const reportIssue = () => {
      ElMessage.info('正在打开问题反馈...')
      // 这里可以添加报告问题的逻辑
    }
    
    return {
      goHome,
      goBack,
      contactSupport,
      reportIssue
    }
  }
}
</script>

<style scoped>
.not-found-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1edf0 0%, #e8e0e5 100%);
  padding: 20px;
}

.not-found-content {
  text-align: center;
  background: white;
  border-radius: 16px;
  padding: 60px 40px;
  box-shadow: 0 10px 30px rgba(113, 75, 103, 0.1);
  max-width: 600px;
  width: 100%;
}

.icon-section {
  position: relative;
  margin-bottom: 40px;
}

.error-code {
  font-size: 120px;
  font-weight: 700;
  color: #714B67;
  line-height: 1;
  margin-bottom: 20px;
  text-shadow: 2px 2px 4px rgba(113, 75, 103, 0.1);
}

.warning-icon {
  color: #922575;
  margin-bottom: 20px;
}

.message-section {
  margin-bottom: 40px;
}

.title {
  font-size: 28px;
  font-weight: 600;
  color: #714B67;
  margin: 0 0 20px 0;
  font-family: "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

.description {
  font-size: 16px;
  color: #666;
  line-height: 1.6;
  margin: 0;
  max-width: 400px;
  margin: 0 auto;
}

.action-section {
  margin-bottom: 40px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.link-item {
  color: #714B67;
  font-weight: 500;
  transition: color 0.2s ease;
}

.link-item:hover {
  color: #922575;
}

.mr-2 {
  margin-right: 8px;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .not-found-content {
    padding: 40px 20px;
  }
  
  .error-code {
    font-size: 80px;
  }
  
  .title {
    font-size: 24px;
  }
  
  .action-section {
    flex-direction: column;
    align-items: center;
  }
  
  .action-section .el-button {
    width: 200px;
  }
}
</style>
